
log using fpa-bitsaid-appendix-c,replace
version 13.1

use fpa-aid_bits_final,clear

xtset dyad year 
//table a24

quietly xtivreg2 lnaid l.p_polity2 l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf = l.lnt_bit) if oecd_i==1&oecd_j==0, fe first savefirst cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) replace addtext() noni nor2 ctitle("2nd stage Aid")

est restore _xtivreg2_L_bit_ratf
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext(Time trend, yes, Dyad FE, yes) noni nor2 ctitle("1st stage BITs")drop(yr*)

//table a25 
gen inter1=bit_ratf*dpi_yio
gen inter1_ex=lnt_bit*dpi_yio
///democracies
quietly xtivreg2 lnaid l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2>=6&p_polity2!=., fe first  savefirst cluster(dyad)
outreg2 using bits_aid2, label word dec(3) e(N_clust) replace addtext() noni nor2 ctitle("2nd stage Aid") drop(yr*) 
est restore _xtivreg2_L_bit_ratf
outreg2 using bits_aid2, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("1st stage BITs") drop(yr*) cttop(Democracies)
est restore _xtivreg2_L_inter1
outreg2 using bits_aid2, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("1st stage Interaction ") drop(yr*)

///non-democracies
quietly xtivreg2 lnaid l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2<6&p_polity2!=., fe first savefirst cluster(dyad)
outreg2 using bits_aid2, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("2nd stage Aid")
est restore _xtivreg2_L_bit_ratf
outreg2 using bits_aid2, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("1st stage BITs") drop(yr*) cttop(Non-Democracies)
est restore _xtivreg2_L_inter1
outreg2 using bits_aid2, label word dec(3) e(N_clust) append addtext(Time trend, yes, Dyad FE, yes) noni nor2 ctitle("1st stage Interaction") drop(yr yrsq)

//table a26
///LDV
quietly xtivreg2 lnaid l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar l.lnaid  yr* (l.bit_ratf = l.lnt_bit) if oecd_i==1&oecd_j==0, fe first savefirst cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) replace addtext() noni nor2 ctitle("LDV")

///jointvotes
quietly xtivreg2 lnaid l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar l.jointvotes2 yr* (l.bit_ratf = l.lnt_bit) if oecd_i==1&oecd_j==0, fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("Jointvotes ")

///other aid
quietly xtivreg2 lnaid l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar l.ln_aid_other yr* (l.bit_ratf = l.lnt_bit) if oecd_i==1&oecd_j==0, fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("Other Aid")

///donor export 
quietly xtivreg2 lnaid l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar l.ln_donor yr* (l.bit_ratf = l.lnt_bit) if oecd_i==1&oecd_j==0, fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("Donor Exports")

///ciri_physint 
quietly xtivreg2 lnaid l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar l.ciri_physint yr* (l.bit_ratf = l.lnt_bit) if oecd_i==1&oecd_j==0, fe first cluster(dyad) 
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() drop(yr*) nor2 ctitle("Human Rights")sortvar(lbit_ratf l.bit_ratf l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar)

//table a27
use fpa-aid_bits_final,clear
//use executive years in office
gen inter1=bit_ratf*dpi_yio
gen inter1_ex=lnt_bit*dpi_yio

///ldv
sort dyad year
////democracies
quietly xtivreg2 lnaid l.lnaid l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2>=6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) replace addtext() noni nor2 ctitle("") drop(yr*) 

////non-democracies
quietly xtivreg2 lnaid l.lnaid l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2<6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("LDV") drop(yr*) 

///jointvotes

////democracies
quietly xtivreg2 lnaid l.jointvotes2 l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2>=6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("") drop(yr*) 

////non-democracies
quietly xtivreg2 lnaid l.jointvotes2 l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2<6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("Joint Votes") drop(yr*) 

///other aid
////democracies
quietly xtivreg2 lnaid ln_aid_other l.jointvotes2 l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar l.lnaid  yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2>=6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("") drop(yr*) 

////non-democracies
quietly xtivreg2 lnaid ln_aid_other l.jointvotes2 l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2<6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("Other Aid") drop(yr*) 

///donor export
////democracies
quietly xtivreg2 lnaid l.ln_donor l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2>=6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("") drop(yr*) 

////non-democracies
quietly xtivreg2 lnaid l.ln_donor l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2<6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("Donor Exports") drop(yr*) 

///human rights
////democracies
quietly xtivreg2 lnaid l.ciri_physint l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2>=6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext() noni nor2 ctitle("") drop(yr*) 

////non-democracies
quietly xtivreg2 lnaid l.ciri_physint l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta l.unsc_member l.ally l.coldwar yr* (l.bit_ratf l.inter1 = l.lnt_bit l.dpi_yio l.inter1_ex) if oecd_i==1&oecd_j==0&p_polity2<6&p_polity2!=., fe first cluster(dyad)
outreg2 using bits_aid, label word dec(3) e(N_clust) append addtext(Time trend, yes, Dyad FE, yes) noni nor2 ctitle("Human Rights") ///
sortvar(l.bit_ratf l.inter1 l.dpi_yio l.p_polity2  l.ln_gdppc l.wdi_gdpgr l.wdi_fdiin l.wdi_natrr l.lnpop l.conflict l.gdpgr_i l.pta unsc_member ally coldwar) ///
drop(yr*) 

log close